package com.ctshk.sapp.tour.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.tour.dto.schedule.SeriesTripScheduleSubsidyDTO;
import com.ctshk.rpc.tour.req.schedule.SeriesTripScheduleSubsidyReq;
import com.ctshk.rpc.tour.service.ISeriesTripScheduleSubsidyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Lenovo
 */
@RestController
@RequestMapping("/series/trip/schedule/subsidy")
@Api(value = "旅行团-其他收入", tags = "旅行团-其他收入")
public class SeriesTripScheduleSubsidyController extends BaseController {
    @DubboReference
    private ISeriesTripScheduleSubsidyService seriesTripScheduleSubsidyService;



    @ApiOperation(value = "添加补贴", notes = "添加补贴")
    @OperationLogAnnotation(operModul = OperationLogModel.TOUR, operType = OperationLogType.ADD, operTitle = "旅行团-其他收入", operDesc = "旅行团-其他收入")
    @PostMapping("/add/subsidy")
    public Result addSubsidy(@RequestBody SeriesTripScheduleSubsidyReq seriesTripScheduleSubsidyReq) {
        seriesTripScheduleSubsidyService.addSubsidy(seriesTripScheduleSubsidyReq, getCurrentUser());
        return Result.success();
    }


    @ApiOperation(value = "查询补贴列表", notes = "查询补贴列表")
    @OperationLogAnnotation(operModul = OperationLogModel.TOUR, operType = OperationLogType.QUERY, operTitle = "查询补贴列表", operDesc = "查询补贴列表")
    @GetMapping("/query/subsidies/{id}")
    public Result<List<SeriesTripScheduleSubsidyDTO>> querySubsidies(@PathVariable Long id) {
        return Result.success(seriesTripScheduleSubsidyService.querySubsidies(id));
    }

    @ApiOperation(value = "修改补贴", notes = "修改补贴")
    @OperationLogAnnotation(operModul = OperationLogModel.TOUR, operType = OperationLogType.QUERY, operTitle = "修改补贴", operDesc = "修改补贴")
    @PostMapping("/change/subsidies")
    public Result updateSubsidies(@RequestBody SeriesTripScheduleSubsidyReq seriesTripScheduleSubsidyReq) {
        seriesTripScheduleSubsidyService.updateSubsidies(seriesTripScheduleSubsidyReq, getCurrentUser());
        return Result.success();
    }

    @ApiOperation(value = "删除补贴", notes = "删除补贴")
    @OperationLogAnnotation(operModul = OperationLogModel.TOUR, operType = OperationLogType.QUERY, operTitle = "删除补贴", operDesc = "删除补贴")
    @PostMapping("/delete/subsidies/{id}")
    public Result deleteSubsidies(@PathVariable Long id) {
        seriesTripScheduleSubsidyService.deleteSubsidies(id);
        return Result.success();
    }


}


